import {createRouter, createWebHistory} from "vue-router";

export default createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      name: 'visual',
      redirect: '/pageEdit',
      component: () => import('@/views/visual'),
      children: [{
        path: '/pageEdit',
        name: 'pageEdit',
        component: () => import('@/views/editor/editor.vue'),
      }]
    },
    {
      path: '/canvas',
      name: 'canvas',
      component: () => import('@/components/canvas/index.vue'),
    },
    // 404页面
    {
      path: '/404',
      name: '404',
      component: () => import('@/views/exceptions/404')
    },
    // 500页面
    {
      path: '/500',
      name: '500',
      component: () => import('@/views/exceptions/500')
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/404',
      hidden: true
    }
  ], // `routes: routes` 的缩写
})
